package controlGraph;

/**
 * @author Administrator
 * This Object is used to store the variables inside the Axiom sets
 */
public class Variable extends LValue {
	
	private String VarName;
	
	public Variable(String Name){
		this.VarName =  Name;
	}

	@Override
	public String toString() {
		return this.VarName;
	}
	
	public String getVariable(){
		return this.VarName;
	}
	
	public boolean isSame(Expression e){
		if(!(e instanceof Variable)){
			return false;
		}
		if(((Variable)e).getVariable().compareTo(this.VarName) == 0)
			return true;
		
		return false;
	}
	
	public boolean equals(Object e){
		if(!(e instanceof Variable)){
			return false;
		}
		if(((Variable)e).getVariable().compareTo(this.VarName) == 0)
			return true;
		
		return false;
	}
	
	public int hashCode(){
		int hash = 701;
		for(int i=0;i<this.VarName.length();i++){
			hash = hash * this.VarName.charAt(i);
		}
		return hash;
	}
}
